/**
 * 
 */
package com.gragra.nounIdentification;
import it.unimi.dsi.fastutil.ints.IntCollection;
import it.unimi.dsi.fastutil.ints.IntIterator;
import com.gragra.frameStatistics.StatisticsGenerator;
/**
 * @author Christoph Teichmann
 * 26.08.2013
 */
public class SharedTypeWithMostFrequentScorer extends TypesPerTokenScorer
{
	/* (non-Javadoc)
	 * @see com.gragra.nounIdentification.TypesPerTokenScorer#intialScore(com.gragra.frameStatistics.StatisticsGenerator, int)
	 */
	@Override
	protected double intialScore(StatisticsGenerator sg, int frame)
	{
		double d = 0.0;
		IntCollection ic = sg.getCoOccurringWords(frame);
		if(!this.checkForPunct(sg, frame))
		{
			IntIterator iit = getFrequent().iterator();
			while(iit.hasNext())
			{
				int fra = iit.nextInt();
				IntCollection other = sg.getCoOccurringWords(fra);
				IntIterator io = other.iterator();
				while(io.hasNext())
				{d -= ic.contains(io.nextInt()) ? 1.0 : 0.0;}
			}
		}
		return d;
	}
}